﻿using Microsoft.EntityFrameworkCore;

namespace AiQiuQuan.Sport.Core
{
    /// <summary>
    /// EntityFrameworkCoreUpdateExtensions
    /// </summary>
    public static class EntityFrameworkCoreUpdateExtensions
    {
        public static BatchUpdateBuilder<TEntity> BatchUpdate<TEntity>(this DbContext ctx) where TEntity : class
        {
            var dbSet = ctx.Set<TEntity>();
            var builder = new BatchUpdateBuilder<TEntity>(ctx, dbSet);
            return builder;
        }

        public static BatchUpdateBuilder<TEntity> BatchUpdate<TEntity>(this DbSet<TEntity> dbSet, DbContext ctx) where TEntity : class
        {
            var builder = new BatchUpdateBuilder<TEntity>(ctx, dbSet);
            return builder;
        }
    }
}
